<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function foo(i){
            var  a= parseInt((i/1000+5)%10);
            var  b= parseInt(((i%1000)/100+5)%10);
            var  c= parseInt(((i%100)/10+5)%10);
            var  d= parseInt((i%10+5)%10);
            console.log(''+d+c+b+a);
        }
        foo(3715);
    </script>
</body>
</html>